//
//  userSecondTableViewCell.m
//  lmq
//
//  Created by 千翼网络科技 on 2017/1/17.
//  Copyright © 2017年 yuanxin. All rights reserved.
//

#import "userSecondTableViewCell.h"
#import "myorderViewController.h"
#import "MyRefoundViewController.h"
#import "SuccessfulDealViewController.h"
#import "ForTheGoodsViewController.h"
#import "ForThePaymentViewController.h"
#import "ToSendTheGoodsViewController.h"
#import "Masonry.h"

@implementation userSecondTableViewCell

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        self.backView=[[UIView alloc]initWithFrame:CGRectMake(0,  0, DEF_SCREEN_WIDTH, (125))];
        self.backView.backgroundColor=[UIColor whiteColor];
        [self addSubview:self.backView];
        
        //我的订单
        self.orderButton=[[UIButton alloc]initWithFrame:CGRectMake(0, 0, DEF_SCREEN_WIDTH, (44))];
        [self.orderButton addTarget:self action:@selector(orderButtonClick) forControlEvents:UIControlEventTouchUpInside];
        [self.backView addSubview:self.orderButton];
        
        
        UILabel *orderLabel=[[UILabel alloc]initWithFrame:CGRectMake((10), (14), (80), (16))];
        orderLabel.text=@"我的订单";
        orderLabel.textColor=[ZJCModel colorWithString:@"222222"];
        [self.orderButton addSubview:orderLabel];
        UILabel *allLabel=[[UILabel alloc]initWithFrame:CGRectMake(DEF_SCREEN_WIDTH-(95), (15), (80), (14))];
        allLabel.text=@"所有订单";
        allLabel.textColor=[ZJCModel colorWithString:@"666666"];
        [self.orderButton addSubview:allLabel];
        UIImageView *youImageView=[[UIImageView alloc]initWithFrame:CGRectMake(DEF_SCREEN_WIDTH-(20), (15), (14), (14))];
        youImageView.image=[UIImage imageNamed:@"next"];
        [self.orderButton addSubview:youImageView];
        
        //线
        self.xianView=[[UIView alloc]initWithFrame:CGRectMake((10), (44), DEF_SCREEN_WIDTH-(20), (1))];
        self.xianView.backgroundColor=[ZJCModel colorWithString:@"f2f2f2"];
        [self.backView addSubview:self.xianView];
        
        //待付款
        self.dfkButton=[[UIButton alloc]initWithFrame:CGRectMake((30), (45+11),(DEF_SCREEN_WIDTH-(30*6))/5 , (53))];
//        self.dfkButton.backgroundColor=[UIColor redColor];
        [self.dfkButton addTarget:self action:@selector(dfkButtonClick) forControlEvents:UIControlEventTouchUpInside];
        [self.backView addSubview:self.dfkButton];
        self.labelData1 = [[UILabel alloc] init];
        
        self.labelData1.backgroundColor = [UIColor redColor];
        self.labelData1.font = [UIFont systemFontOfSize:8];
        self.labelData1.textColor = [UIColor whiteColor];
        self.labelData1.textAlignment = NSTextAlignmentCenter;
        
        [self.dfkButton addSubview:self.labelData1];
        self.labelData1.layer.cornerRadius = 6;
        self.labelData1.layer.masksToBounds = YES;
        self.labelData1.text = @"99";
        
        UIImageView *dfkImageView=[[UIImageView alloc]initWithFrame:CGRectMake((4), (2), (30), (30))];
        dfkImageView.image=[UIImage imageNamed:@"daifukuan"];
        [self.dfkButton addSubview:dfkImageView];
        
        [self.labelData1 mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(dfkImageView.mas_right).with.offset(-5);
            make.top.equalTo(dfkImageView.mas_top).with.offset(2);
            make.height.offset(12);
            make.width.offset(12);
        }];
        UILabel *dfkLabel=[[UILabel alloc]initWithFrame:CGRectMake((2), (32+3), (DEF_SCREEN_WIDTH-(20*6))/5, (20))];
        dfkLabel.text=@"待付款";
        dfkLabel.font=[UIFont systemFontOfSize:(12)];
        [self.dfkButton addSubview:dfkLabel];
        
        //待发货
        self.dfhButton=[[UIButton alloc]initWithFrame:CGRectMake((60+(DEF_SCREEN_WIDTH-(30*6))/5), (45+11),(DEF_SCREEN_WIDTH-(30*6))/5 , (53))];
        [self.dfhButton addTarget:self action:@selector(dfhButtonClick) forControlEvents:UIControlEventTouchUpInside];
        [self.backView addSubview:self.dfhButton];
        
        UIImageView *dfhImageView=[[UIImageView alloc]initWithFrame:CGRectMake((4), (2), (30), (30))];
        dfhImageView.image=[UIImage imageNamed:@"daifahuo"];
        [self.dfhButton addSubview:dfhImageView];
        
        self.labelData2 = [[UILabel alloc] init];
        
        self.labelData2.backgroundColor = [UIColor redColor];
        self.labelData2.font = [UIFont systemFontOfSize:8];
        self.labelData2.textColor = [UIColor whiteColor];
        self.labelData2.textAlignment = NSTextAlignmentCenter;
        
        [self.dfhButton addSubview:self.labelData2];
        self.labelData2.layer.cornerRadius = 6;
        self.labelData2.layer.masksToBounds = YES;
        self.labelData2.text = @"99";
        
        [self.labelData2 mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(dfhImageView.mas_right).with.offset(-5);
            make.top.equalTo(dfhImageView.mas_top).with.offset(2);
            make.height.offset(12);
            make.width.offset(12);
        }];
        
        UILabel *dfhLabel=[[UILabel alloc]initWithFrame:CGRectMake((2), (32+3), (DEF_SCREEN_WIDTH-(20*6))/5, (20))];
        dfhLabel.text=@"待发货";
        dfhLabel.font=[UIFont systemFontOfSize:(12)];
        [self.dfhButton addSubview:dfhLabel];
        
        //待收货
        self.dshButton=[[UIButton alloc]initWithFrame:CGRectMake((90+(DEF_SCREEN_WIDTH-(30*6))/5*2), (45+11),(DEF_SCREEN_WIDTH-(30*6))/5 , (53))];
        [self.dshButton addTarget:self action:@selector(dshButtonClick) forControlEvents:UIControlEventTouchUpInside];
        [self.backView addSubview:self.dshButton];
        
        
        
        UIImageView *dshImageView=[[UIImageView alloc]initWithFrame:CGRectMake((4), (2), (30), (30))];
        dshImageView.image=[UIImage imageNamed:@"daishouhuo"];
        [self.dshButton addSubview:dshImageView];
        self.labelData3 = [[UILabel alloc] init];
        
        self.labelData3.backgroundColor = [UIColor redColor];
        self.labelData3.font = [UIFont systemFontOfSize:8];
        self.labelData3.textColor = [UIColor whiteColor];
        self.labelData3.textAlignment = NSTextAlignmentCenter;
        
        [self.dshButton addSubview:self.labelData3];
        self.labelData3.layer.cornerRadius = 6;
        self.labelData3.layer.masksToBounds = YES;
        self.labelData3.text = @"99";
        
        [self.labelData3 mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(dshImageView.mas_right).with.offset(-5);
            make.top.equalTo(dshImageView.mas_top).with.offset(2);
            make.height.offset(12);
            make.width.offset(12);
        }];
        UILabel *dshLabel=[[UILabel alloc]initWithFrame:CGRectMake((2), (32+3), (DEF_SCREEN_WIDTH-(20*6))/5, (20))];
        dshLabel.text=@"待收货";
        dshLabel.font=[UIFont systemFontOfSize:(12)];
        [self.dshButton addSubview:dshLabel];
        
        //交易成功
        self.jycgButton=[[UIButton alloc]initWithFrame:CGRectMake((120+(DEF_SCREEN_WIDTH-(30*6))/5*3), (45+11),(DEF_SCREEN_WIDTH-(30*6))/5 , (53))];
        [self.jycgButton addTarget:self action:@selector(jycgButtonClick) forControlEvents:UIControlEventTouchUpInside];
        [self.backView addSubview:self.jycgButton];
        
        UIImageView *jycgImageView=[[UIImageView alloc]initWithFrame:CGRectMake((4), (2), (30), (30))];
        jycgImageView.image=[UIImage imageNamed:@"jiaoyichenggong"];
        [self.jycgButton addSubview:jycgImageView];
        
        UILabel *jycgLabel=[[UILabel alloc]initWithFrame:CGRectMake((-5), (32+3), (DEF_SCREEN_WIDTH-(20*6))/3, (20))];
        jycgLabel.text=@"交易成功";
        jycgLabel.font=[UIFont systemFontOfSize:(12)];
        [self.jycgButton addSubview:jycgLabel];
        
        //退款退货
        self.tkthButton=[[UIButton alloc]initWithFrame:CGRectMake((150+(DEF_SCREEN_WIDTH-(30*6))/5*4), (45+11),(DEF_SCREEN_WIDTH-(30*6))/5 , (53))];
        [self.tkthButton addTarget:self action:@selector(tkthButtonClick) forControlEvents:UIControlEventTouchUpInside];
        [self.backView addSubview:self.tkthButton];
        
        UIImageView *tkthImageView=[[UIImageView alloc]initWithFrame:CGRectMake((4), (2), (30), (30))];
        tkthImageView.image=[UIImage imageNamed:@"tuihuotuikuan"];
        [self.tkthButton addSubview:tkthImageView];
        
        UILabel *tkthLabel=[[UILabel alloc]initWithFrame:CGRectMake((-5), (32+3), (DEF_SCREEN_WIDTH-(20*6))/3, (20))];
        tkthLabel.text=@"退款退货";
        tkthLabel.font=[UIFont systemFontOfSize:(12)];
        [self.tkthButton addSubview:tkthLabel];
        
        //xianer
        self.xianView=[[UIView alloc]initWithFrame:CGRectMake(0, (120), DEF_SCREEN_WIDTH, (5))];
        self.xianView.backgroundColor=[ZJCModel colorWithString:@"f2f2f2"];
        [self.backView addSubview:self.xianView];

    }
    return self;
}

-(void)dfkButtonClick{
    NSLog(@"待付款");
    myorderViewController *myoderVC=[[myorderViewController alloc]init];
    myoderVC.hidesBottomBarWhenPushed=YES;
    myoderVC.index = 1;
    [((userViewController *)self.secondViewController).navigationController pushViewController:myoderVC animated:YES];
}

-(void)dfhButtonClick{
    NSLog(@"待发货");
    myorderViewController *myoderVC=[[myorderViewController alloc]init];
    myoderVC.hidesBottomBarWhenPushed=YES;
    myoderVC.index = 2;
    [((userViewController *)self.secondViewController).navigationController pushViewController:myoderVC animated:YES];
}

-(void)dshButtonClick{
    NSLog(@"待收货");
    myorderViewController *myoderVC=[[myorderViewController alloc]init];
    myoderVC.hidesBottomBarWhenPushed=YES;
    myoderVC.index = 3;
    
    [((userViewController *)self.secondViewController).navigationController pushViewController:myoderVC animated:YES];
}

-(void)jycgButtonClick{
    NSLog(@"交易成功");
    //    SuccessfulDealViewController *myoderVC=[[SuccessfulDealViewController alloc]init];
    //    myoderVC.hidesBottomBarWhenPushed=YES;
    myorderViewController *myoderVC=[[myorderViewController alloc]init];
    myoderVC.hidesBottomBarWhenPushed=YES;
    myoderVC.index = 4;
    [((userViewController *)self.secondViewController).navigationController pushViewController:myoderVC animated:YES];
}

-(void)tkthButtonClick{
    NSLog(@"退款/退货");
    MyRefoundViewController *myoderVC=[[MyRefoundViewController alloc]init];
    myoderVC.hidesBottomBarWhenPushed=YES;
    [((userViewController *)self.secondViewController).navigationController pushViewController:myoderVC animated:YES];
}

-(void)orderButtonClick{
    NSLog(@"我的订单");
    myorderViewController *myoderVC=[[myorderViewController alloc]init];
    myoderVC.hidesBottomBarWhenPushed=YES;
    myoderVC.index = 0;
    
    [((userViewController *)self.secondViewController).navigationController pushViewController:myoderVC animated:YES];
}
- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
